#include <iostream>

using namespace std;
  struct TreeNode {
 	int val;
 	struct TreeNode *left;
 	struct TreeNode *right;
 	TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
  };
 
class Solution {
public:

    int _Height(TreeNode* pRoot)
    {
        if (pRoot == nullptr)
        {
            return 0;
        }
        int leftHeight = _Height(pRoot->left);
        int rightHeight = _Height(pRoot->right);
        return leftHeight > rightHeight ? leftHeight + 1 : rightHeight + 1;
    }
    bool IsBalanced_Solution(TreeNode* pRoot)
    {
        if (pRoot == nullptr)
        {
            return true;
        }

        if (abs(_Height(pRoot->left) - _Height(pRoot->right)) > 1)
        {
            return false;
        }
        return IsBalanced_Solution(pRoot->left) && IsBalanced_Solution(pRoot->right);

    }
};

#include <iostream>
using namespace std;

int func()
{
    int h, a, H, A;
    cin >> h >> a >> H >> A;

    if (a >= H) return -1;
    int m = (H / a) + (H % a == 0 ? 0 : 1);
    int n = m - 1;
    int x = n * A;
    int ret = h / x - (h % x == 0 ? 1 : 0);

    return ret;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        cout << func() << endl;
    }
}

#include <iostream>
#include <unordered_set>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string str;
    unordered_set<string> s;
    for (int i = 0; i < n; i++)
    {
        cin >> str;
        sort(str.begin(), str.end());
        s.insert(str);
    }

    cout << s.size() << endl;
    return 0;
}

